#!/bin/bash

# Helper to create an instance, start it and change to it.
# This script could receive a parameter for the instance name.
#
# Version: 2018-01-28
# Author: Andres Gomez Casanova (AngocA)
# Made in COLOMBIA.

# Checks if a parameter is given
INSTANCE_NAME=$1
if [ -z ${INSTANCE_NAME} ] ; then
  INSTANCE_NAME=db2inst1
else
  sed -i.bak "s/db2inst1/${INSTANCE_NAME}/g" ${DB2_RESP_FILE}
fi

cat ${DB2_RESP_FILE}

# Creates the instance according to the response file.
echo "Creating instance..."
${DB2_DIR}/instance/db2isetup -r ${DB2_CONF}/${DB2_RESP_FILE}

